const baseUrl = "http://localhost:8080/api/v1/"; //演示地址
export const http = (config: any) => {
  return new Promise((resolve, reject) => {
    uni.showLoading({
      title: "加载中...",
    });
    uni.request({
      url: baseUrl + config.url,
      method: config.method || "GET",
      data: config.data || {},
      //   header:{Authorization:'xxx'},看需求添加
      success: (res) => {
        resolve(res.data);
      },
      fail: (err) => {
        reject(err);
      },
      complete: () => {
        uni.hideLoading();
      },
    });
  });
};
